3.3.2 \(\int \cot ^3(e+f x) (a+b \tan ^2(e+f x))^2 \, dx\) [202]

Optimal. Leaf size=56 \[ -\frac {a^2 \cot ^2(e+f x)}{2 f}-\frac {(a-b)^2 \log (\cos (e+f x))}{f}-\frac {a (a-2 b) \log (\tan (e+f x))}{f} \]

[Out]

-1/2*a^2*cot(f*x+e)^2/f-(a-b)^2*ln(cos(f*x+e))/f-a*(a-2*b)*ln(tan(f*x+e))/f

________________________________________________________________________________________

Rubi [A]
time = 0.06, antiderivative size = 56, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, integrand size = 23, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.130, Rules used = {3751, 457, 90} \begin {gather*} -\frac {a^2 \cot ^2(e+f x)}{2 f}-\frac {a (a-2 b) \log (\tan (e+f x))}{f}-\frac {(a-b)^2 \log (\cos (e+f x))}{f} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Cot[e + f*x]^3*(a + b*Tan[e + f*x]^2)^2,x]

[Out]

-1/2*(a^2*Cot[e + f*x]^2)/f - ((a - b)^2*Log[Cos[e + f*x]])/f - (a*(a - 2*b)*Log[Tan[e + f*x]])/f

Rule 90

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p_.), x_Symbol] :> Int[ExpandI
ntegrand[(a + b*x)^m*(c + d*x)^n*(e + f*x)^p, x], x] /; FreeQ[{a, b, c, d, e, f, p}, x] && IntegersQ[m, n] &&
(IntegerQ[p] || (GtQ[m, 0] && GeQ[n, -1]))

Rule 457

Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_))^(q_.), x_Symbol] :> Dist[1/n, Subst[Int
[x^(Simplify[(m + 1)/n] - 1)*(a + b*x)^p*(c + d*x)^q, x], x, x^n], x] /; FreeQ[{a, b, c, d, m, n, p, q}, x] &&
 NeQ[b*c - a*d, 0] && IntegerQ[Simplify[(m + 1)/n]]

Rule 3751

Int[((d_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_.), x_Symbol]
 :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Dist[c*(ff/f), Subst[Int[(d*ff*(x/c))^m*((a + b*(ff*x)^n)^p/(c^2
 + ff^2*x^2)), x], x, c*(Tan[e + f*x]/ff)], x]] /; FreeQ[{a, b, c, d, e, f, m, n, p}, x] && (IGtQ[p, 0] || EqQ
[n, 2] || EqQ[n, 4] || (IntegerQ[p] && RationalQ[n]))

Rubi steps

\begin {align*} \int \cot ^3(e+f x) \left (a+b \tan ^2(e+f x)\right )^2 \, dx &=\frac {\text {Subst}\left (\int \frac {\left (a+b x^2\right )^2}{x^3 \left (1+x^2\right )} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac {\text {Subst}\left (\int \frac {(a+b x)^2}{x^2 (1+x)} \, dx,x,\tan ^2(e+f x)\right )}{2 f}\\ &=\frac {\text {Subst}\left (\int \left (\frac {a^2}{x^2}-\frac {a (a-2 b)}{x}+\frac {(a-b)^2}{1+x}\right ) \, dx,x,\tan ^2(e+f x)\right )}{2 f}\\ &=-\frac {a^2 \cot ^2(e+f x)}{2 f}-\frac {(a-b)^2 \log (\cos (e+f x))}{f}-\frac {a (a-2 b) \log (\tan (e+f x))}{f}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.17, size = 51, normalized size = 0.91 \begin {gather*} -\frac {a^2 \cot ^2(e+f x)+2 (a-b)^2 \log (\cos (e+f x))+2 a (a-2 b) \log (\tan (e+f x))}{2 f} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Cot[e + f*x]^3*(a + b*Tan[e + f*x]^2)^2,x]

[Out]

-1/2*(a^2*Cot[e + f*x]^2 + 2*(a - b)^2*Log[Cos[e + f*x]] + 2*a*(a - 2*b)*Log[Tan[e + f*x]])/f

________________________________________________________________________________________

Maple [A]
time = 0.16, size = 53, normalized size = 0.95

method result size
derivativedivides \(\frac {-b^{2} \ln \left (\cos \left (f x +e \right )\right )+2 a b \ln \left (\sin \left (f x +e \right )\right )+a^{2} \left (-\frac {\left (\cot ^{2}\left (f x +e \right )\right )}{2}-\ln \left (\sin \left (f x +e \right )\right )\right )}{f}\) \(53\)
default \(\frac {-b^{2} \ln \left (\cos \left (f x +e \right )\right )+2 a b \ln \left (\sin \left (f x +e \right )\right )+a^{2} \left (-\frac {\left (\cot ^{2}\left (f x +e \right )\right )}{2}-\ln \left (\sin \left (f x +e \right )\right )\right )}{f}\) \(53\)
norman \(-\frac {a^{2}}{2 f \tan \left (f x +e \right )^{2}}+\frac {\left (a^{2}-2 a b +b^{2}\right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2 f}-\frac {a \left (a -2 b \right ) \ln \left (\tan \left (f x +e \right )\right )}{f}\) \(63\)
risch \(i a^{2} x -2 i a b x +i b^{2} x +\frac {2 i b^{2} e}{f}+\frac {2 i a^{2} e}{f}-\frac {4 i a b e}{f}+\frac {2 a^{2} {\mathrm e}^{2 i \left (f x +e \right )}}{f \left ({\mathrm e}^{2 i \left (f x +e \right )}-1\right )^{2}}-\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) b^{2}}{f}-\frac {a^{2} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-1\right )}{f}+\frac {2 a \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-1\right ) b}{f}\) \(140\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(f*x+e)^3*(a+b*tan(f*x+e)^2)^2,x,method=_RETURNVERBOSE)

[Out]

1/f*(-b^2*ln(cos(f*x+e))+2*a*b*ln(sin(f*x+e))+a^2*(-1/2*cot(f*x+e)^2-ln(sin(f*x+e))))

________________________________________________________________________________________

Maxima [A]
time = 0.28, size = 54, normalized size = 0.96 \begin {gather*} -\frac {b^{2} \log \left (\sin \left (f x + e\right )^{2} - 1\right ) + {\left (a^{2} - 2 \, a b\right )} \log \left (\sin \left (f x + e\right )^{2}\right ) + \frac {a^{2}}{\sin \left (f x + e\right )^{2}}}{2 \, f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)^3*(a+b*tan(f*x+e)^2)^2,x, algorithm="maxima")

[Out]

-1/2*(b^2*log(sin(f*x + e)^2 - 1) + (a^2 - 2*a*b)*log(sin(f*x + e)^2) + a^2/sin(f*x + e)^2)/f

________________________________________________________________________________________

Fricas [A]
time = 0.98, size = 100, normalized size = 1.79 \begin {gather*} -\frac {b^{2} \log \left (\frac {1}{\tan \left (f x + e\right )^{2} + 1}\right ) \tan \left (f x + e\right )^{2} + a^{2} \tan \left (f x + e\right )^{2} + {\left (a^{2} - 2 \, a b\right )} \log \left (\frac {\tan \left (f x + e\right )^{2}}{\tan \left (f x + e\right )^{2} + 1}\right ) \tan \left (f x + e\right )^{2} + a^{2}}{2 \, f \tan \left (f x + e\right )^{2}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)^3*(a+b*tan(f*x+e)^2)^2,x, algorithm="fricas")

[Out]

-1/2*(b^2*log(1/(tan(f*x + e)^2 + 1))*tan(f*x + e)^2 + a^2*tan(f*x + e)^2 + (a^2 - 2*a*b)*log(tan(f*x + e)^2/(
tan(f*x + e)^2 + 1))*tan(f*x + e)^2 + a^2)/(f*tan(f*x + e)^2)

________________________________________________________________________________________

Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 131 vs. \(2 (48) = 96\).
time = 1.80, size = 131, normalized size = 2.34 \begin {gather*} \begin {cases} \tilde {\infty } a^{2} x & \text {for}\: \left (e = 0 \vee e = - f x\right ) \wedge \left (e = - f x \vee f = 0\right ) \\x \left (a + b \tan ^{2}{\left (e \right )}\right )^{2} \cot ^{3}{\left (e \right )} & \text {for}\: f = 0 \\\frac {a^{2} \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} - \frac {a^{2} \log {\left (\tan {\left (e + f x \right )} \right )}}{f} - \frac {a^{2}}{2 f \tan ^{2}{\left (e + f x \right )}} - \frac {a b \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{f} + \frac {2 a b \log {\left (\tan {\left (e + f x \right )} \right )}}{f} + \frac {b^{2} \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} & \text {otherwise} \end {cases} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)**3*(a+b*tan(f*x+e)**2)**2,x)

[Out]

Piecewise((zoo*a**2*x, (Eq(e, 0) | Eq(e, -f*x)) & (Eq(f, 0) | Eq(e, -f*x))), (x*(a + b*tan(e)**2)**2*cot(e)**3
, Eq(f, 0)), (a**2*log(tan(e + f*x)**2 + 1)/(2*f) - a**2*log(tan(e + f*x))/f - a**2/(2*f*tan(e + f*x)**2) - a*
b*log(tan(e + f*x)**2 + 1)/f + 2*a*b*log(tan(e + f*x))/f + b**2*log(tan(e + f*x)**2 + 1)/(2*f), True))

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 167 vs. \(2 (57) = 114\).
time = 1.15, size = 167, normalized size = 2.98 \begin {gather*} \frac {a^{2} {\left (\frac {\cos \left (f x + e\right ) + 1}{\cos \left (f x + e\right ) - 1} + \frac {\cos \left (f x + e\right ) - 1}{\cos \left (f x + e\right ) + 1}\right )} - 4 \, b^{2} \log \left ({\left | -\frac {\cos \left (f x + e\right ) + 1}{\cos \left (f x + e\right ) - 1} - \frac {\cos \left (f x + e\right ) - 1}{\cos \left (f x + e\right ) + 1} - 2 \right |}\right ) + 4 \, {\left (a^{2} - 2 \, a b + b^{2}\right )} \log \left ({\left | -\frac {\cos \left (f x + e\right ) + 1}{\cos \left (f x + e\right ) - 1} - \frac {\cos \left (f x + e\right ) - 1}{\cos \left (f x + e\right ) + 1} + 2 \right |}\right )}{8 \, f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)^3*(a+b*tan(f*x+e)^2)^2,x, algorithm="giac")

[Out]

1/8*(a^2*((cos(f*x + e) + 1)/(cos(f*x + e) - 1) + (cos(f*x + e) - 1)/(cos(f*x + e) + 1)) - 4*b^2*log(abs(-(cos
(f*x + e) + 1)/(cos(f*x + e) - 1) - (cos(f*x + e) - 1)/(cos(f*x + e) + 1) - 2)) + 4*(a^2 - 2*a*b + b^2)*log(ab
s(-(cos(f*x + e) + 1)/(cos(f*x + e) - 1) - (cos(f*x + e) - 1)/(cos(f*x + e) + 1) + 2)))/f

________________________________________________________________________________________

Mupad [B]
time = 12.09, size = 68, normalized size = 1.21 \begin {gather*} \frac {\ln \left ({\mathrm {tan}\left (e+f\,x\right )}^2+1\right )\,\left (\frac {a^2}{2}-a\,b+\frac {b^2}{2}\right )}{f}+\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )\right )\,\left (2\,a\,b-a^2\right )}{f}-\frac {a^2\,{\mathrm {cot}\left (e+f\,x\right )}^2}{2\,f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(e + f*x)^3*(a + b*tan(e + f*x)^2)^2,x)

[Out]

(log(tan(e + f*x)^2 + 1)*(a^2/2 - a*b + b^2/2))/f + (log(tan(e + f*x))*(2*a*b - a^2))/f - (a^2*cot(e + f*x)^2)
/(2*f)

________________________________________________________________________________________